--- getopt-core.h	2017-05-15 19:05:30.377063268 +0200
+++ getopt-core.h.new	2017-05-15 19:10:17.203267905 +0200
@@ -20,6 +20,14 @@
 #ifndef _GETOPT_CORE_H
 #define _GETOPT_CORE_H 1
 
+/* Ensure that DLL_VARIABLE is defined.  Since on OSF/1 4.0 and Irix 6.5
+   <stdlib.h> includes <getopt.h>, and <config.h> is not a prerequisite for
+   using <stdlib.h>, this file can be included without a prior
+   "#include <config.h>".  */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 /* This header should not be used directly; include getopt.h or
    unistd.h instead.  Unlike most bits headers, it does not have
    a protective #error, because the guard macro for getopt.h in
@@ -33,7 +41,7 @@
    Also, when 'ordering' is RETURN_IN_ORDER,
    each non-option ARGV-element is returned here.  */
 
-extern char *optarg;
+extern DLL_VARIABLE char *optarg;
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
@@ -47,16 +55,16 @@
    Otherwise, 'optind' communicates from one call to the next
    how much of ARGV has been scanned so far.  */
 
-extern int optind;
+extern DLL_VARIABLE int optind;
 
 /* Callers store zero here to inhibit the error message 'getopt' prints
    for unrecognized options.  */
 
-extern int opterr;
+extern DLL_VARIABLE int opterr;
 
 /* Set to an option character which was unrecognized.  */
 
-extern int optopt;
+extern DLL_VARIABLE int optopt;
 
 /* Get definitions and prototypes for functions to process the
    arguments in ARGV (ARGC of them, minus the program name) for
